package com.wuhao.shootclient.util;

import android.text.format.Time;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 获取时间
 */
public class TimeUtils {

    /**
     * 获取年月日
     * @return
     */
    public static String getTime(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss.SSS");
        Date date = new Date(System.currentTimeMillis());
        return simpleDateFormat.format(date);
    }

    /**
     * 获取时间戳
     * @return
     */
   public static String getTimeStamp(){
       long currentTime = System.currentTimeMillis();
       return String.valueOf(currentTime);
   }

    /**
     * 获取年份
     * @return
     */
    public static int getYear(){
        Time t=new Time();
        t.setToNow();
        return t.year;
    }

    /**
     * 获取月份
     * @return
     */
    public static int getMonth(){
        Time time = new Time();
        time.setToNow();
        return time.month+1;
    }

    public static int getDay(){
        Time time = new Time();
        time.setToNow();
        return time.monthDay;
    }

}
